All Questions
8 questions
3votes
2answers
185views
Map coloring algorithm functional implementation in python
I'm an autodidact working on map coloring algorithms with backtracking, see chapter 2 of this book. I tested this implementation with success but I'm still unsure whether it is tricking me somewhere, ...
1vote
2answers
610views
Removing Elements from an Array Based on a Second Array
I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
1vote
1answer
58views
Optimizing the Dig Pow function
I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
7votes
5answers
1kviews
Optimizing a function to find the closest multiple of 10
I have written a Python function called closest_multiple_10() which takes an integer as input and returns the closest multiple of 10. The function works as expected,...
1vote
1answer
939views
Python implementation of Quicksort using list comprehensions
I wrote an implementation of quicksort that I think is pythonic. I based it off of this common Haskell implementation: ...
2votes
1answer
1kviews
Functional Scrabble Word Score
Homework: Write a function to score a scrabble word. values is a global dict formatted as values = {'a': 1, 'b': 3,...} The ...
6votes
4answers
4kviews
Mastermind: Evaluating the guess
The evaluate_guess function below returns the evaluation of a guess with respect to Mastermind game rules: ...
1vote
2answers
7kviews
Functional prime factor generator
I have this prime factor generator for some number n. It returns list of all prime factors. In other words, product of the list equals ...